#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
int main()
{
	int x=15, y=6;
	int m, i;
	char input;
	int fire = 1;
	int aim = 30, q = 1;
	int sj, point=0;
	while (1)
	{
		system("cls");

		loop:
		if (q == 1)
		{
			for (m = 1; m < aim; m++)
				printf(" ");
			printf("X");
		}
		else if (q == 0)
		{
			srand(time(NULL));
			sj = 1 + rand() %49;
			aim = sj;
			q = 1;
			point++;
			goto loop;
		}
		if (fire == 1)
		{
			for (i = 1; i < y; i++)
				printf("\n");
		}
		else if(fire==-1)
		{
			for (i = 1; i < y; i++)
			{
				for (m = 1; m < x + 2; m++)
					printf(" ");
				printf("^\n");
			}
		}
		for (m = 1; m < x; m++)
		printf(" ");
		printf("  *\n");
		for (m = 1; m < x; m++)
			printf(" ");
		printf("*****\n");
		for (m = 1; m < x; m++)
			printf(" ");
		printf(" * *\n");
		for (m = 1; m < 60; m++)
			printf(" ");
		printf("POINT : %d", point);

		input = _getch();
		if (input == 'w')
			y--;
		else if (input == 's')
			y++;
		else if (input == 'a')
		{
			x--;
			if (fire == -1 && x + 3 == aim)
				q = 0;
		}
		else if (input == 'd')
		{
			x++;
			if (fire == -1 && x + 3 == aim)
				q = 0;
		}
		else if (input == ' ')
			fire = -fire;
	}
	return 0;
}